package com.baibei.ebec.user.register;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.RaeTabLayout;
import android.support.v4.view.ViewPager;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.baibei.basic.IPresenter;
import com.baibei.ebec.sdk.IUserApi;
import com.baibei.ebec.user.R;
import com.baibei.ebec.user.R2;
import com.baibei.module.AppRouter;
import com.baibei.module.BasicActivity;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 注册
 * Created by ChenRui on 2017/8/2 0002 14:51.
 */
@Route(path = AppRouter.ROUTER_USER_REGISTER)
public class RegisterActivity extends BasicActivity {

    @BindView(R2.id.view_pager)
    ViewPager mViewPager;

    @BindView(R2.id.tab_layout)
    RaeTabLayout mTabLayout;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        setNavigationIcon(R.drawable.ic_closed);
//        RaeFragmentAdapter adapter = new RaeFragmentAdapter(getSupportFragmentManager());
//        adapter.add("个人用户", RegisterFragment.newInstance(IUserApi.TYPE_PERSONAL));
//        adapter.add("企业用户", RegisterFragment.newInstance(IUserApi.TYPE_ENTERPRISE));
//
//        mViewPager.setAdapter(adapter);
//        mTabLayout.setupWithViewPager(mViewPager);
//
//        int tab = getIntent().getIntExtra("tab", 0);
//        if (tab > 0) {
//            mViewPager.setCurrentItem(tab);
//        }

        getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, RegisterFragment.newInstance(IUserApi.TYPE_PERSONAL)).commit();
    }

    @Override
    public IPresenter getBasicPresenter() {
        return null;
    }

    @Override
    protected void onActivityResultOK(int requestCode, Intent data) {
        if (requestCode == AppRouter.REQ_SCAN_CODE) return;
        super.onActivityResultOK(requestCode, data);
    }

    @OnClick(R2.id.btn_login)
    public void onLoginClick() {
        AppRouter.routeToLogin(this);
    }

    @Override
    public void finish() {
        super.finish();
        this.overridePendingTransition(android.R.anim.fade_in, R.anim.activity_slide_out_down);
    }
}
